package com.baidu.synthesis.controller;

import com.baidu.synthesis.config.baidu.BaiduApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuzhiqiang
 */
@RestController
@Slf4j
@CrossOrigin
@Api(tags = {"语音合成"})
public class SpeechSynthesisController {

    @Autowired
    private BaiduApi baiduApi;


    @ApiOperation(value = "在线合成")
    @GetMapping("online")
    @ApiImplicitParam(name = "text", value = "语音文本", dataType = "String", paramType = "query", defaultValue = "你好，百度。")
    public ResponseEntity<byte[]> online(String text) {
        return baiduApi.onlineSynthesis(text);
    }


}
